package game;

/**
 * 子弹对象
 */

import javax.swing.*;
import java.awt.*;

public class Bullet {

    private int x;
    private int y;
    private int width;//子弹的属性
    private int height;
    private ImageIcon bulletImageIcon = new ImageIcon("img/bullet.png");

    public Bullet(int x,int y){
        width = bulletImageIcon.getIconWidth();
        height = bulletImageIcon.getIconHeight();
        this.x = x;
        this.y = y;
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public int getHeight() {
        return height;
    }

    public void setHeight(int height) {
        this.height = height;
    }

    public ImageIcon getBulletImageIcon() {
        return bulletImageIcon;
    }

    public void setBulletImageIcon(ImageIcon bulletImageIcon) {
        this.bulletImageIcon = bulletImageIcon;
    }

    public void drawImage(Graphics g) {
        g.drawImage(bulletImageIcon.getImage(), x, y, null);
    }

    public void move() {
        this.y -=4;//往上走
    }
}